using System.Collections;
using UnityEngine;

public class ConstGlassFillingUp : MonoBehaviour
{
	private void StartConstGlassFillingUp(GameController gameController)
	{
		StartCoroutine(ConstGlassFillingUpCoroutine(gameController));
	}

	private IEnumerator ConstGlassFillingUpCoroutine(GameController gameController)
	{
		float value = 1f;
		float time = 0.2f;
		float delta = Time.smoothDeltaTime;
		float curValue = delta * value / time;
		while (time > 0f)
		{
			time = Mathf.Max(0f, time - delta);
			gameController.GlassFillingUp(curValue);
			yield return new WaitForSeconds(delta);
		}
		gameController.GlassFillingUp(0f);
		Object.DestroyObject(base.gameObject);
	}

	public static void CreateObject(GameController gameController)
	{
		GameObject gameObject = new GameObject();
		gameObject.AddComponent<ConstGlassFillingUp>().StartConstGlassFillingUp(gameController);
	}
}
